﻿Imports CapaLogica.CL.Usuario
Imports CapaLogica.CL.PeriodoLectivo

Public Class frm_inicio

    Private Sub PeriodoLectivoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim form As New frmAbrirPeriodoLectivo
        mostrarFormulario(form)

    End Sub

    Private Sub AdministraciónDeBitácoraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AdministraciónDeBitácoraToolStripMenuItem.Click
        Dim form As New frmBuscarBitacora
        mostrarFormulario(form)
    End Sub

    Private Sub IngresarToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmIngresarUsuario.Click
        Dim form As frmRegistrarModificarUsuario = New frmRegistrarModificarUsuario()
        form.cargarFormInsert()
        form.ind_accion.Text = "IN"
        form.Show()
        mostrarFormulario(form)
    End Sub

    Private Sub BuscarToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmBuscarUsuario.Click
        Dim form As New frmBuscarUsuario
        mostrarFormulario(form)
    End Sub

    Private Sub IngresarToolStripMenuItem1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmIngresarCarrera.Click
        Dim form As New frmRegistrarCarrera
        mostrarFormulario(form)
    End Sub

    Private Sub BuscarToolStripMenuItem1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmBuscarCarrera.Click
        Dim form As New frmBuscarCarrera
        mostrarFormulario(form)
    End Sub

    Private Sub IngresarToolStripMenuItem2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmIngresarCursos.Click
        Dim form As New frmRegistrarCurso
        mostrarFormulario(form)
    End Sub

    Private Sub BuscarToolStripMenuItem2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmBuscarCursos.Click
        Dim form As New frmBuscarCurso
        mostrarFormulario(form)
    End Sub

    Private Sub CargaMasivaToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmCargaMasivaCursos.Click
        Dim form As New frmCargaMasivaCurso
        mostrarFormulario(form)
    End Sub

    Private Sub CrearToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmIngresarGrupo.Click
        Try
            GestorPeriodoLectivo.validarQuePeriodoLectivoEstaAbierto("ingresar grupo")
            Dim pantalla As frmAdministrarGrupo = New frmAdministrarGrupo("Crear Grupo")
            mostrarFormulario(pantalla)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error")
        End Try
    End Sub


    Private Sub BuscarToolStripMenuItem3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmBuscarGrupo.Click
        Dim form As New frmBuscarGrupo
        mostrarFormulario(form)
    End Sub

    Private Sub MisForosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim pantalla As frmForoProfesor = New frmForoProfesor(2)
        mostrarFormulario(pantalla)
    End Sub

    Private Sub MatricularToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmMatricular.Click
        Dim form As New frmMatricularEstudiante
        mostrarFormulario(form)
    End Sub

    Private Sub GraduarToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmGraduar.Click
        Dim form As New frmGraduarEstudiante
        mostrarFormulario(form)
    End Sub

    Private Sub AsignarCarreraToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Try
            GestorPeriodoLectivo.validarQuePeriodoLectivoEstaCerrado("cambiar carrera")
            Dim form As New frmAsignarCarreraEstudiante
            mostrarFormulario(form)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error")
        End Try

    End Sub

    Private Sub CargaMasivaToolStripMenuItem1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmCargaMasivaEstudiantes.Click
        Dim form As New frmCargarMasivaEstudiantes
        mostrarFormulario(form)
    End Sub

    Private Sub AdministraciónDeBlogsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AdministraciónDeBlogsToolStripMenuItem.Click
        Dim form As New frmAdministrarBlog
        mostrarFormulario(form)
    End Sub

    Private Sub BuscarTemaToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim form As New frmBuscarTema
        mostrarFormulario(form)
    End Sub

    Private Sub tsmMisForosTool_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmMisForosTool.Click
        Dim pantalla As frmForoProfesor = New frmForoProfesor(Session.Id)
        mostrarFormulario(pantalla)
    End Sub

    Private Sub tsmPeriodoLectivo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmPeriodoLectivo.Click
        Dim pantalla As frmAbrirPeriodoLectivo = New frmAbrirPeriodoLectivo()
        mostrarFormulario(pantalla)
    End Sub

    Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click
        Dim form As New frmAyuda
        mostrarFormulario(form)
    End Sub

    Private Sub SalirToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem1.Click
        Session.Id = Nothing
        Me.Dispose()


    End Sub

    Private Sub BuscarTemaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BuscarTemaToolStripMenuItem.Click
        Dim pantalla As frmBuscarTema = New frmBuscarTema()
        mostrarFormulario(pantalla)
    End Sub



    Private Sub mostrarFormulario(ByRef formChild As Form)

        If Me.MdiChildren.Length > 0 Then
            For i = 0 To Me.MdiChildren.Length - 1
                MdiChildren(i).Close()
            Next
        End If

        formChild.MdiParent = Me
        formChild.Dock = DockStyle.None
        'Escoge el tamaño del form al form hijo
        Me.ClientSize = formChild.Size()
        formChild.Show()

    End Sub

    Private Sub frm_inicio_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


